package com.myNovel.novel.controller.author;

import com.myNovel.novel.core.auth.UserHolder;
import com.myNovel.novel.core.common.constant.ApiRouterConstants;
import com.myNovel.novel.core.common.resp.RestResp;
import com.myNovel.novel.dao.entity.AuthorInfo;
import com.myNovel.novel.dto.req.AuthorRegisterReqDto;
import com.myNovel.novel.dto.resp.AuthorRegisterRespDto;
import com.myNovel.novel.service.AuthorService;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author：Guxx
 * @Package：com.myNovel.novel.controller.author
 * @Date：2024/4/1 19:44
 * @Filename：AuthorController
 */
@RestController
@RequestMapping(ApiRouterConstants.API_AUTHOR_URL_PREFIX)
@RequiredArgsConstructor
public class AuthorController {
    private AuthorService authorService;

    @PostMapping("register")
    public RestResp<Void> register(@Valid @RequestBody AuthorRegisterReqDto dto){
        dto.setUserId(UserHolder.getUserId());
        return authorService.register(dto);
    }
}
